package com.baseweb.webadmin.core.model.dao.impl;

import com.baseweb.webadmin.core.model.bvo.RoleRescBvo;
import com.baseweb.webadmin.core.model.dao.RoleRescDao;
import com.baseweb.webadmin.core.model.pojo.Resc;
import org.mybatis.spring.support.SqlSessionDaoSupport;

import java.util.List;

public class RoleRescDaoImpl extends SqlSessionDaoSupport implements RoleRescDao {

    @Override
    public List<Resc> selectRescs() {
        return this.getSqlSession().selectList("com.baseweb.webadmin.core.model.dao.RoleRescDao.selectRescs");
    }

    @Override
    public Resc selectRescByNameAndResString(Resc resc) {
        return (Resc) this.getSqlSession().selectList("com.baseweb.webadmin.core.model.dao.RoleRescDao.selectRescByNameAndResString", resc).get(0);
    }

    @Override
    public List<Resc> getRescByUserId(Long id) {
        return this.getSqlSession().selectList("com.baseweb.webadmin.core.model.dao.RoleRescDao.getRescByUserId", id);
    }

    @Override
    public List<Resc> getRescByRole(Integer id) {
        return this.getSqlSession().selectList("com.baseweb.webadmin.core.model.dao.RoleRescDao.getRescByRole", id);
    }

    @Override
    public List<RoleRescBvo> selectRnameAndRes() {
        return this.getSqlSession().selectList("com.baseweb.webadmin.core.model.dao.RoleRescDao.selectRnameAndRes");
    }
}
